﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel.Dispatcher;

namespace ModularAndPlugin.ESB.WCFPlugin.Extensibility
{
    public class ExtensibilityInspector : IParameterInspector
    {
        #region Properties
        private Type ServiceContractType { get; set; }
        #endregion

        #region Constructors
        public ExtensibilityInspector(Type serviceContractType)
        {
            ServiceContractType = serviceContractType;
        }
        #endregion

        #region IParameterInspector Members

        public void AfterCall(string operationName, object[] outputs, object returnValue, object correlationState)
        {
            
        }

        public object BeforeCall(string operationName, object[] inputs)
        {
            ExtensibilityManager.Instance.InvokeExtension(this.ServiceContractType, operationName, inputs);
            return null;
        }

        #endregion
    }
}